import axios from 'axios';
import nProgress from 'nprogress';
import 'nprogress/nprogress.css';

const service = axios.create({
        baseURL: '/mock',
        timeout: 5000
    });

        //请求拦截
    service.interceptors.request.use((config) => {
        nProgress.start();
        return config
    }, (err) => {
        
    })
    //响应拦截
    service.interceptors.response.use((res) => {
        nProgress.done();   
        return res.data    
    }, (err) => {
        nProgress.done();   
        return new Promise((params) => {
            
        })
    })

    export default service